home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1990 June
/
1990-06.d64
/
bas_beg 2
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
722b
|
18 lines
5 print"[147][154] basic for beginners - program 2":poke53280,0:poke53281,0
6 printspc(6)"press a key to hear example[146]"
7 get d$:if d$="" then 7
10 m=256:d=10:rem multiplier and duration
20 j=54272:for k=j to j+23:poke k,0:next:rem clear sound chip
30 poke j+24,15:rem full volume
40 poke j+3,8:rem voice 1 square wave
50 poke j+5,15:poke j+6,12:rem voice 1 envelope
60 read x
70 x1=int(x/m):x2=x-x1*m:rem calculate pokeable frequency values
80 poke j+1,x1:poke j,x2:rem voice 1 frequency values
90 poke j+4,65:rem turn note on
100 t=ti+d:rem read ti, add duration
110 if ti<>t then 110:rem loop until new ti = sum of old ti + duration
120 poke j+4,64:if x=0 then end:rem turn note off
130 goto 60:rem go back for another note
1000 data 4291,4817,5407,5728,6430,7217,8101,8583,0:rem from prog. ref. guide